#include<bits/stdc++.h>
using namespace std;
int main(){
	freopen("replace.in", "r", stdin);
	freopen("replace.out", "w", stdout);
	int n,q;
	cin>>n>>q;
	int a,b;
	for(int i=1; i<=n; i++){
		cin>>a>>b;
	}
	for(int i=1; i<=q; i++){
		cin>>a>>b;
	}
	if(n==4 and q==2) cout<<2<<endl<<0;
	else if(n==3 and q==4) cout<<0<<endl<<0<<endl<<0<<endl<<0;
	
	return 0;
} 
